﻿
//"use strict";

var deviceService = (function () {
    var _deviceKey = '';
    var _deviceName = 'unknown'

    function errorHandler(transaction, error) {
        console.log('Oops. Error was ' + error.message + ' (Code ' + error.code + ')');
        return true;
    }

    function errorHandlerSimple(error) {
        console.log('Oops. Error was ' + error.message + ' (Code ' + error.code + ')');
        return true;
    }

    //Getting the device key
    function RefreshDeviceInfo() {
        console.log('entering RefreshDeviceInfo')

        if (_deviceKey == '') {

            //PHONEGAP CODE
            _deviceKey = '12121212'; 
            //_deviceKey = device.uuid;
        }

        if (_deviceName == 'unknown')
        {
            //PHONEGAP CODE
            _deviceName = 'sampledevicename';
            //_deviceName = 'sampledevicename' //device.name;
        }
    }
    return {

      

        //Return the device key
        deviceKey: function () {
            RefreshDeviceInfo();
            return _deviceKey;
        },

        //Return the device name
        deviceName: function () {
            RefreshDeviceInfo();
            return _deviceName;
        },

  
        //Add new Method here

    };
}());

